package com.yj.web.WeChat.Bean;

import com.yj.web.WeChat.Message.WxXmlOutNewsMessage;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by yanlinyang on 2017/9/10.
 */
public class NewsBuilder extends BaseBuilder<NewsBuilder, WxXmlOutNewsMessage> {
    protected final List<WxXmlOutNewsMessage.Item> articles = new ArrayList<WxXmlOutNewsMessage.Item>();

    public NewsBuilder addArticle(WxXmlOutNewsMessage.Item item) {
        this.articles.add(item);
        return this;
    }

    public WxXmlOutNewsMessage build() {
        WxXmlOutNewsMessage m = new WxXmlOutNewsMessage();
        for(WxXmlOutNewsMessage.Item item : articles) {
            m.addArticle(item);
        }
        setCommon(m);
        return m;
    }
}
